const Test = () => import('@/views/test') // 测试页面
const Home = () => import('@/views/home') // 首页
const English = () => import('@/views/english') // 每日英语
const Todo = () => import('@/views/todo') // todoList
const Overtime = () => import('@/views/overtime') // 加班
const OvertimeSetting = () => import('@/views/overtime/OvertimeSetting') // 加班设置
const OvertimeEdit = () => import('@/views/overtime/OvertimeEdit') // 加班设置
const Upload = () => import('@/views/upload')
const UploadList = () => import('@/views/upload/UploadList')
const Color = () => import('@/views/color')

const isDev = process.env.NODE_ENV === 'development'

const routes = [
  {
    path: '/home',
    meta: { title: '首页' },
    name: 'home',
    component: Home
  },
  {
    path: '/english',
    meta: { title: '每日英语' },
    name: 'english',
    component: English
  },
  {
    path: '/upload',
    meta: { title: '临时图床' },
    name: 'upload',
    component: Upload
  },
  {
    path: '/uploadList',
    meta: { title: '图片瀑布流' },
    name: 'uploadList',
    component: UploadList
  },
  {
    path: '/color',
    meta: { title: '颜色' },
    name: 'color',
    component: Color
  },
  {
    path: '/todo',
    meta: { title: 'todo list' },
    name: 'todo',
    component: Todo
  },
  {
    path: '/overtime',
    meta: { title: '加班记录', needLogin: true },
    name: 'overtime',
    component: Overtime
  },
  {
    path: '/overtimeSetting',
    meta: { title: '基础设置', needLogin: true },
    name: 'overtimeSetting',
    component: OvertimeSetting
  },
  {
    path: '/overtimeEdit',
    meta: { title: '编辑加班', needLogin: true },
    name: 'overtimeEdit',
    component: OvertimeEdit
  },
  {
    path: '*',
    name: 'redirect',
    redirect: { name: isDev ? 'english' : 'english' },
    meta: { title: '重定向' }
  }
]

// 测试页面
if (isDev) {
  routes.push({
    path: '/test',
    name: 'test',
    meta: { title: '测试页面' },
    component: Test
  })
}

export default routes
